#pragma once

#include "cocos2d.h"
#include <list>

USING_NS_CC;
using namespace std;

class CNode
{
public:
	short index;
	short costFromStart;
	short costToGoal;
	short parentNode;
	CCPoint tilePos;
};

class CPathEngine
{
public:
	void SetMap(CCTMXTiledMap* map);
	bool IsValidPoint(CCPoint);
	void findPath(CCPoint& startPos, CCPoint& goalPos, list<CCPoint> &pathlist);

private:
	CCTMXTiledMap* _map;

	short CreateNodeIndex(CCPoint point){ return point.y * 100 + point.x; }
	void GetChildNode(CNode &node, vector<CNode> &vtNewNode );
};